<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Function Learning2</title>
    <script>
      'use strict'
      //方法
      let xiaoming = {
          name:'小明',
          height:177,
          birthday:1999,
          age:function(){
              let year = new Date().getFullYear();
              return year-this.birthday;
          }
      };
      console.log(xiaoming.name+xiaoming.age());
      
      function getAge(){
              let year = new Date().getFullYear();
              return year-this.birthday;
          }

      let xiaoli = {
          name:'小李',
          height:177,
          birthday:1999,
          age:getAge
      };
      console.log(xiaoli.name+xiaoli.age());
      console.log(getAge.apply(xiaoli,[]));
    </script>
</head>

<body>

</body>

</html>